<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title th:if="${type} eq 'inspectiontask'">巡检记录统计</title>
        <title th:if="${type} eq 'wipe'">消缺记录统计</title>
        <title>巡检记录统计</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" th:href="@{/css/font.css}">
        <link rel="stylesheet" th:href="@{/css/xadmin.css}">
        <link rel="stylesheet" href="../lib/layui/css/layui.css" media="all">
        <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
        <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
        <script src="../js/jquery.min.js" charset="utf-8"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-card-header" th:if="${type} eq 'inspectiontask'">巡检记录统计</div>
                <div class="layui-card-header" th:if="${type} eq 'wipe'">消缺记录统计</div>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">任务编号：</label>
                            <div class="layui-input-inline">
                                <input class="layui-input" name="taskId" id="taskId" autocomplete="off">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">线路编号：</label>
                            <div class="layui-input-inline">
                                <input class="layui-input" name="lineCode" id="lineCode" autocomplete="off">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">有无故障：</label>
                            <div class="layui-input-inline">
                                <select id="isBug" lay-filter="xmFilter" name="isBug">
                                    <option value="">--请选择--</option>
                                    <option value="1">有</option>
                                    <option value="0">无</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline" >
                            <button class="layui-btn" lay-submit="" lay-filter="search">查询</button>
                        </div>
                    </div>
                </form>
                <div class="layui-col-md12">
                    <div class="layui-card" style="padding-bottom: 1px">
                        <div class="layui-card-body ">
                            <table class="layui-table" lay-data="{url:'/statistics/getIs',page:true,limit:5,toolbar: '#toolbarDemo',id:'is'}" lay-filter="demo">
                                <thead>
                                    <tr>
                                        <th lay-data="{field:'taskId', width:100}">任务编号</th>
                                        <th lay-data="{field:'lineCode', width:100}">线路编号</th>
                                        <th lay-data="{field:'poleCode', width:100}">杆塔编号</th>
                                        <th th:if="${type} eq 'wipe'" lay-data="{field:'isBug',templet: function(d) {return d==0?'无':'有'; }, width:100}">有无故障</th>
                                        <th lay-data="{field:'bugLevelName', width:100}">缺陷级别</th>
                                        <th lay-data="{field:'bugTypeName', width:100}">缺陷类型</th>
                                        <th th:if="${type} eq 'wipe'" lay-data="{field:'inspectTime', templet: function(d) {return layui.util.toDateString(d.create_time*1000);}, width:200}">消缺时间</th>
                                        <th lay-data="{field:'discoverTime', templet: function(d) {return layui.util.toDateString(d.create_time*1000);}, width:200}">发现时间</th>
                                        <th lay-data="{field:'bugDesc', width:300}">缺陷描述</th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                        <script type="text/html" id="toolbarDemo"></script>
                    </div>
                </div>
            </div>
        </div>
        <script>
            layui.use(['table', 'layer', 'form'], function () {

                var form=layui.form;
                var table=layui.table;
                //查询
                form.on('submit(search)', function(data){
                    var formData=data.field;
                    var taskId=formData.taskId;
                    var lineCode=formData.lineCode;
                    var isBug=formData.isBug;
                    url=formData.url;
                    icon=formData.icon;
                    parent_id=formData.parent_id;
                    table.reload('is', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        }
                        , where: {
                            taskId: taskId,
                            lineCode: lineCode,
                            isBug: isBug
                        }
                        , url: '/statistics/getIs'
                        , method: 'post'
                    });
                    return false;
                });


            });


        </script>
    </body>
</html>